package com.jswl.training.springjpa.config;

import com.jswl.training.springjpa.config.interceptor.RequestInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 定制spring mvc功能
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {


    /**
     * 添加拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new RequestInterceptor())
                //要拦截的url
                .addPathPatterns("/**")
                //放行的方法
                .excludePathPatterns("/","/test/requestParam");
    }


}